home *** CD-ROM | disk | FTP | other *** search
/ Inside Mac Games Volume 3 #4 / IMG 26 April 1995.iso / More Goodies / All Things Marathon / Marathon Editors / Mara. OPE 1.3 / FileFormats / Marathon File Specs < prev   
Text File  |  1995-03-15  |  40KB  |  1,362 lines

  1. Unofficial MARATHON Specs
  2. release version v0.0 - January 19, 1995
  3.  
  4. brought to you by:
  5.  
  6. freidin@phoenix.princeton.edu (Bernie Freidin)
  7.  
  8. special thanks to:
  9.  
  10. pjcreath@phoenix.princeton.edu (Peter Creath)
  11. omv@cool-toys.mit.edu (Danimal)
  12. bhines@sdcc13.ucsd.edu (Clef)
  13. MORBID@resnova.com
  14.  
  15. ...and of course:
  16.  
  17. jon3@quads.uchicago.edu (Jason Jones)
  18.  
  19. ------------------------------------------------------------------------------
  20. GENERAL INFORMATION
  21. ------------------------------------------------------------------------------
  22.  
  23. Marathon consists of the following files:
  24.  
  25.    %"Marathon" (application program)
  26.    %"Shapes" (contains graphics)
  27.    %"Sounds" (contains sounds)
  28.    %"Map" (contains level information)
  29.    %"Music" (contains music information, but *not* the samples of the notes)
  30.    %"Physics Model" (optional - contains physics information)
  31.  
  32.    %saved games (contains mostly level information)
  33.    %films (contains sequence of keystrokes)
  34.  
  35. The following information is contained in each file:
  36.  
  37. "Marathon" (type 'APPL', creator '26.2')
  38.  
  39.    Program code, and the usual assortment of resources found in most Mac
  40. applications. The only interesting things here are the resources of type 'term',
  41. which contain the text displayed on the computer terminals in the game.
  42.  
  43. "Shapes" (type 'shps')
  44.  
  45.    All graphic data for textures, sprites, and interfaces, stored as resources
  46. of type '.256'. There are also 'clut' resources (color tables), and 'PICT'
  47. resources that contain the pictures displayed between levels. I'm not sure
  48. whether the color tables here are used, or the color tables stored in the main
  49. application. See below for more information on the format of '.256' resources.
  50.  
  51. "Sounds" (type 'sndz')
  52.  
  53.    All game sounds. These are stored as ordinary Mac 'snd ' resources, of format
  54. 1. See Inside Macintosh for more information.
  55.  
  56. "Map" (type 'scen')
  57.  
  58.    Map information for all levels, stored in the data fork. See below for more
  59. information.
  60.  
  61. "Music" (type 'msik')
  62.  
  63.    Music sequencing information, stored in the data fork. Exact format unknown,
  64. but is supposedly it is some form of MIDI .
  65.  
  66. "Physics Model" (type 'phys')
  67.  
  68.    Physical infomation, stored in the data fork. There is also a 'text' resource
  69. put in by Jason giving a short description of some of the format for this file.
  70. See below for more information.
  71.  
  72. saved games (type 'sgam')
  73.  
  74.    Same information as "Map" files, stored in the data fork. There should be
  75. only one level, however, and the 'EPNT' chunk is replaced by a 'PNTS' chunk (see
  76. below). Also contained in these files is a 'PICT' resource of a portion of the
  77. level map (as seen in the preview box), and a 'STR ' resource containing the
  78. level name.
  79.  
  80. films (type 'film')
  81.  
  82.    Contains keystroke information necessary to replay a game. Exact format
  83. unknown.
  84.  
  85. #define NONE -1
  86.  
  87. typedef long fixed;
  88. typedef unsigned short angle;
  89. typedef struct shape_descriptor
  90. {
  91.    char set;
  92.    char frame;
  93. };
  94. typedef short world_distance;
  95. typedef struct world_point2d
  96. {
  97.    world_distance x, y;
  98. };
  99.  
  100. ------------------------------------------------------------------------------
  101. SHAPES INFORMATION
  102. ------------------------------------------------------------------------------
  103.  
  104. Header format:
  105.  
  106. Each '.256' resource starts with a 544 byte header:
  107.  
  108. enum /* shapes classes */
  109. {
  110.    _shapeUnused,
  111.    _shapeTexture, /* RAW */
  112.    _shapeSprite, /* RLE */
  113.    _shapeInterface, /* RAW */
  114.    _shapeScenery /* RLE */
  115. };
  116.  
  117. %_shapeUnused: not used
  118. %_shapeTexture: usually 128x128 pixels, but not always
  119. %_shapeSprite: all monsters, guns, objects..
  120. %_shapeInterface: everything that doesn't go in the window
  121. %_shapeScenery: ???
  122.  
  123. struct shapes_header /* 544 bytes */
  124. {
  125.    short type; 
  126.    short class; 
  127.    unsigned short flags; 
  128.  
  129.    short color_count;
  130.    short palette_count;
  131.    long first_palette_address;
  132.  
  133.    short high_level_shapes_count;
  134.    long high_level_shapes_table;
  135.  
  136.    short low_level_shapes_count;
  137.    long low_level_shapes_table;
  138.  
  139.    short image_count;
  140.    long image_table;
  141.  
  142.    short scale_factor;
  143.    long size;
  144.  
  145.    short unused[253];
  146. };
  147.  
  148. %type: always equals 3
  149. %class: see above
  150. %flags: 
  151. %color_count: number of color entries in each palette
  152. %palette_count: number of palettes (different palettes are used for different
  153. "variations" of monsters)
  154. %first_palette_address: offset to first palette
  155. %high_level_shapes_count: number of high-level shapes
  156. %high_level_shapes_table: offset to table of addresses of high-level shape
  157. records
  158. %low_level_shapes_count: number of low-level shapes
  159. %low_level_shapes_table: offset to table of addresses of low-level shape records
  160. %image_count: number of images
  161. %image_table: offset to table of addresses of images
  162. %size: size of entire resource
  163.  
  164. Palettes:
  165.  
  166. Each palette contain color_count entries, where each entry has the following
  167. structure:
  168.  
  169. struct color_entry /* 8 bytes */
  170. {
  171.    short entry_number; /* ranges from 0 to color_count - 1 */
  172.    unsigned short red;
  173.    unsigned short green;
  174.    unsigned short blue;
  175. };
  176.  
  177. The palettes are stored consecutively with no gaps between.
  178.  
  179. High-level shapes:
  180.  
  181.    These describe an entire animated sequence, complete with sound effects and
  182. frame rate information. The exact format is as follows:
  183.  
  184. enum /* high-level shape flags */
  185. {
  186. };
  187.  
  188. enum /* high-level shape types */
  189. {
  190. };
  191.  
  192. struct high_level_shape /* 88 bytes */
  193. {
  194.    short type;
  195.    unsigned short flags;
  196.  
  197.    char name_length;
  198.    char name[33];
  199.  
  200.    short view_count;
  201.    short frames_per_view;
  202.    short ticks_per_frame;
  203.  
  204.    short key_frame;
  205.  
  206.    short transfer_mode;
  207.    short transfer_mode_period; /* in ticks */
  208.  
  209.    short first_frame_sound;
  210.    short key_frame_sound;
  211.    short last_frame_sound;
  212.  
  213.    short scale_factor;
  214.  
  215.    short unused[15];
  216.  
  217.    //frame information
  218. };
  219.  
  220. %type: see above
  221. %flags: see above
  222. %name_length: length of name string (i.e. this is a Pascal string)
  223. %name: ASCII string
  224. %view_count: number of angles at which this animation can be viewed. This should
  225. only be 1, 2, 5, or 8.
  226. %frames_per_view: number of frames of animation
  227. %ticks_per_frame: speed of animation
  228. %key_frame: frame at which "something happens"?
  229. %transfer_mode: 
  230. %transfer_mode_period: absolutely no idea..
  231. %first_frame_sound: 'snd ' resource to play at start of animation
  232. %key_frame_sound: 'snd ' resource to play at key frame
  233. %last_frame_sound: 'snd ' resource to play at end of animation
  234. %scale_factor: 
  235.  
  236. After this comes the frame information, which is a series of 2-byte words, each
  237. corresponding to a low-level shape. There will be view_count * frames_per_view
  238. entries, followed by 2 bytes of zero signifying to end of the animation. Note
  239. that if view_count equals 5, then it's really 8 * frames_per_view entries.
  240.  
  241. Low-level shapes:
  242.  
  243.    These describe just one non-animated sprite, or one frame of an animated
  244. sequence. The exact format is as follows:
  245.  
  246. enum /* low-level shape flags */
  247. {
  248.    _lowShapeXMirror =    0x8000,
  249.    _lowShapeYMirror =    0x4000,
  250.    _lowShapeKeyObscure = 0x2000
  251. }
  252.  
  253. %_lowShapeXMirror: indicates that the sprite is to be drawn from right to left
  254. rather than left to right
  255. %_lowShapeYMirror: similar to _lowShapeXMirror, but affects drawing vertically
  256. rather than horizontally. It doesn't seem to be implemented
  257. %_lowShapeKeyObscure: ???
  258.  
  259. struct low_level_shape /* 36 bytes */
  260. {
  261.    unsigned short flags;
  262.  
  263.    fixed minimum_light_intensity;
  264.    short image_index;
  265.    short x_origin, y_origin;
  266.    short x_key, y_key;
  267.    short left, right, top, bottom;
  268.    short world_x_origin, world_y_origin;
  269.  
  270.    short unused[4];
  271. };
  272.  
  273. %flags: see above
  274. %minimum_light_intensity: minimum light value that can be assigned to this
  275. image. Used for "bright" sprites, such as explosions, that are never supposed to
  276. be dark.
  277. %image_index: indicates which image is used to draw this low-level shape
  278. %x_origin, y_origin: center of shape? Who knows..
  279. %x_key, y_key: no idea..
  280. %left, top, right, bottom: defines the bounding rectangle?
  281. %world_x_origin, world_y_origin: no idea..
  282.  
  283. Images:
  284.  
  285.    These contain the actual graphic data for the images. First is a header, then
  286. follows the scan start address table, and then the pixel data. The exact format
  287. of the pixel data depends on the type of shape (RAW or RLE).
  288.  
  289. struct image_header /* 26 bytes */
  290. {
  291.    short width;
  292.    short height;
  293.    short unknown[11]; /* ??? */
  294. };
  295.  
  296. %width: width of image
  297. %height: height of image
  298.  
  299.     Next comes the scan start addresses. These are run-time calculated, so there is
  300. no need to provide valid information here. However, the right amount of space
  301. must be reserved for this block. The size of the block will be width * 4, plus 4
  302. bytes at the end (unknown?).
  303.  
  304.    And finally comes the actual image data. In RAW format, this is just a block
  305. of bytes, where each byte corresponds to one pixel. The pixels are stored top to
  306. bottom, then right to left. The color of a pixel can be determined by using the
  307. pixel value as an index into the palette.
  308.    RLE format is a little different. It starts with a 2-byte command word. If
  309. this word is greater than zero, it signifies the start of a vertical run of
  310. pixels. The pixel data follows immediately, and the number of pixels is equal to
  311. the command word. If the command word is negative, it signifies the start of a
  312. vertical "skip" in which no pixels are drawn (a hole). The length of the skip
  313. will be equal to negative the value of the command word. If the command word is
  314. zero, it signifies the start of the next vertical column, which will start one
  315. pixel to the right of the start of the first column. The command words are
  316. repeated until the entire sprite is drawn.
  317.  
  318. ------------------------------------------------------------------------------
  319. PHYSICS MODEL INFORMATION
  320. ------------------------------------------------------------------------------
  321.  
  322.    The Physics Model contains information on gravity, weapon speed, monster
  323. behavior, and many other things. I'm not sure where the default physics
  324. information is stored (there doesn't appear to be any in the Marathon
  325. application, nor the Map files..).
  326.    Like the Map file, the Physics Model is made up of a number of "chunks", each
  327. of which contains a number of "entries". The following chunk types are known:
  328.  
  329.  
  330. Chunk types:
  331.  
  332. 'mons': Monster information
  333. 'effe': Effect information
  334. 'proj': Projectile information
  335. 'phys': Physics information
  336. 'weap': Weapon information
  337.  
  338.    Each chunk starts with a header, which has the following format:
  339.  
  340. struct physics_chunk_header /* 12 bytes */
  341. {
  342.    long chunk_type;
  343.    short unused[2];
  344.    short entry_count;
  345.    short entry_size;
  346. };
  347.  
  348. %chunk_type: 4 character ASCII string signifying chunk type
  349. %entry_count: number of entries in chunk
  350. %entry_size: size of each entry
  351.  
  352. Why do the Physics Model chunks follow a different format from the Map chunks?
  353.  
  354. ------------------------------------------------------------------------------
  355. 'mons' chunk:
  356. ------------------------------------------------------------------------------
  357.  
  358. The Monster chunk defines every monster in the game, including non-hostiles.
  359. A couple of things to note - first, different 'colored' monsters are defined seperately.
  360. Second, the monster chunk references the effects chunk for animations when they get hit,
  361. the projectile chunk for the projectiles they shoot (in the attack structure), and the
  362. shapes directly for their moving shapes.
  363.  
  364. enum /* monster flags */
  365. {
  366.    _monsterOmniscent =          0x00000001,
  367.    _monsterFly =                0x00000002,
  368.    _monsterAlien =              0x00000004,
  369.    _monsterMajor =              0x00000008,
  370.    _monsterMinor =              0x00000010,
  371.    _monsterNoDrop =             0x00000020,
  372.    _monsterFloat =              0x00000040,
  373.    _monsterNoAttack =           0x00000080,
  374.    _monsterSnipe =              0x00000100,
  375.    _monsterInvisible =          0x00000200,
  376.    _monsterSubInvisible =       0x00000400,
  377.    _monsterKamakazi =           0x00000800,
  378.    _monsterBerserk =            0x00001000,
  379.    _monsterEnlarged =           0x00002000,
  380.    _monsterDelayedHardDeath =   0x00004000,
  381.    _monsterFiresSymmetrically = 0x00008000,
  382.    _monsterNuclearHardDeath =   0x00010000,
  383.    _monsterNoFireBackwards =    0x00020000,
  384.    _monsterFlammable =          0x00040000
  385. };
  386.  
  387. %_monsterOmniscent: 
  388. %_monsterFly: monster can fly
  389. %_monsterAlien: moves slower on lower levels
  390. %_monsterMajor: type -1 is minor?
  391. %_monsterMinor: type +1 is major?
  392. %_monsterNoDrop: low levels cannot skip monster
  393. %_monsterFloat: 
  394. %_monsterNoAttack: civilian, constantly runs to safety
  395. %_monsterSnipe: use long range weapon to attack from ledges
  396. %_monsterInvisible: monster is invisible
  397. %_monsterSubInvisible: monster is partially invisible
  398. %_monsterKamakazi: explodes if close to player, causing damage
  399. %_monsterBerserk: goes berserk when below 25% vitality
  400. %_monsterEnlarged: 25% larger
  401. %_monsterDelayedHardDeath: always dies soft, then switches to hard?
  402. %_monsterFiresSymmetrically: 
  403. %_monsterNuclearHardDeath: screen turns white and slowly recovers
  404. %_monsterNoFireBackwards: can't turn more than 135 degrees to fire
  405. %_monsterFlammable: susceptible to flame unit
  406.  
  407. Monsters unable to open doors have door retry masks of NONE
  408. Monsters unable to switch levels have min,max ledge deltas of 0
  409. Monsters unstopped by bullets have hit frames of NONE
  410.  
  411. enum /* attack types */
  412. {
  413. };
  414.  
  415. struct attack_struct /* 16 bytes */
  416. {
  417.    short type;
  418.  
  419.    short repetitions;
  420.    angle error;
  421.  
  422.    world_distance range;
  423.    short attack_shape;
  424.  
  425.    world_distance dx;
  426.    world_distance dy;
  427.    world_distance dz;
  428. };
  429.  
  430. %type: see above
  431. %repetitions: number of repetitions of attack
  432. %error: error added to firing angle
  433. %range: range of attack
  434. %attack_shape: attack occurs when keyframe is displayed
  435. %dx,dy,dz: attack vector (dx=out,dy=right,dz=up)
  436.  
  437. enum /* damage flags */
  438. {
  439. };
  440.  
  441. enum /* damage types */
  442. {
  443. };
  444.  
  445. struct damage_struct /* 12 bytes */
  446. {
  447.    short type;
  448.    unsigned short flags;
  449.  
  450.    short base;
  451.    short random;
  452.    fixed scale;
  453. };
  454.  
  455. %type: see above
  456. %flags: see above
  457. %base: base damage
  458. %random: random factor
  459. %scale: ??
  460.  
  461. struct monster_entry /* 138 bytes */
  462. {
  463.    short collection;
  464.  
  465.    short vitality;
  466.    unsigned long immunities;
  467.    unsigned long weaknesses;
  468.    unsigned long flags;
  469.  
  470.    long class;
  471.    unsigned long friends;
  472.    unsigned long enemies;
  473.  
  474.    short activation_sound;
  475.    short conversation_sound;
  476.    short flaming_sound;
  477.    short random_sound;
  478.    short random_sound_mask;
  479.  
  480.    short carrying_item_type;
  481.  
  482.    world_distance radius;
  483.    world_distance height;
  484.    world_distance preferred_hover_height;
  485.    world_distance minimum_ledge_delta;
  486.    world_distance maximum_ledge_delta;
  487.    fixed external_velocity_scale;
  488.    short impact_effect;
  489.    short melee_impact_effect;
  490.  
  491.    short half_visual_arc;
  492.    short half_vertical_visual_arc;
  493.    world_distance visual_range;
  494.    world_distance dark_visual_range;
  495.    short intelligence;
  496.    short speed;
  497.    short gravity;
  498.    short terminal_velocity;
  499.    short door_retry_mask;
  500.    short shrapnel_radius; /* no shapnel if NONE */
  501.    struct damage_struct shrapnel_damage;
  502.  
  503.    shape_descriptor hit_shapes;
  504.    shape_descriptor hard_dying_shape; /* minus dead frame */
  505.    shape_descriptor soft_dying_shape; /* minus dead frame */
  506.    shape_descriptor hard_dead_shapes; /* NONE = vanishing */
  507.    shape_descriptor soft_dead_shapes; /* NONE = vanishing */
  508.    shape_descriptor stationary_shape;
  509.    shape_descriptor moving_shape;
  510.  
  511.    short attack_frequency;
  512.    struct attack_struct melee_attack;
  513.    struct attack_struct ranged_attack;
  514. };
  515.  
  516. %collection:
  517. %vitality:  How much damage the monter can sustain
  518. %immunities: mask of what the monster is immune to
  519. %weaknesses: mask of what the monster is susceptible to
  520. %flags:
  521. %class: bit of which class the monster belongs to
  522. %friends: mask of friend classes
  523. %enemies: mask of enemy classes
  524. %activation_sound: sound made when monster is generated
  525. %conversation_sound: sound made in conversation (?)
  526. %flaming_sound: sound made when the monster gets TOZT'ed
  527. %random_sound: randomly played sound (?)
  528. %random_sound_mask: mask of when to play sound (??)
  529. %carrying_item: something the monster will drop (ex: alien weapon)
  530. %radius: radius of monster
  531. %height: height of monster
  532. %preffered_hover_height: height at which the monsters 'likes' to fly
  533. %maximum_ledge_delta: the maximum a monster can 'climb' up
  534. %minimum_ledge_delta: the maximum a monster can 'climb' down
  535. %external_velocity_scale:  No idea (?!?!?)
  536. %impact effect:  effeect to play when monster hits person {kamikazee?}
  537. %melee_impact_effect:  effect to play when monster whacks person
  538. %half_visual_arc: horizontal visual range {side-to-side vision}
  539. %half_vertical_visual_arc: vertical visual range {up-down vision}
  540. %visual_range: range at which the monster can 'see' something
  541. %dark_visual_range: range at which monster can see in the 'dark' (?)
  542. %intelligence: hmmm... (???)
  543. %speed: how fast the monster goes
  544. %gravity: acceleration on falling monster (?)
  545. %terminal_velocity:  maximum fall rate (?)
  546. %door_retry_mask: something to do with doors - which they can open? (??)
  547. %shrapnel_radius: blast radius when self destructing
  548. %shrapnel_damage: damage structure for self destruction
  549. %hit_shapes: shapes of monster being hit by bullets
  550. %hard/soft_dying_shape: shape of monster dying
  551. %hard/soft_dead_shape: shape of dead monster on floor
  552. %stationary_shape: monster not moving {sitting down, etc}
  553. %moving_shape: normal monster in motion
  554. %attack_frequency: how many ticks between attacks - melee is twice as often as ranged
  555. %melee_attack: attack structure for melee attacks
  556. %ranged_attack: attack structure for ranged attacks
  557.  
  558.  
  559. ------------------------------------------------------------------------------
  560. 'effe' chunk:
  561. ------------------------------------------------------------------------------
  562. This is all guesswork I've got from playing with the effects a bit.  I'm not certain what the
  563. hell the flags are, although they always seem to be either 0 or 4..?
  564.  
  565. struct effect_entry /* 138 bytes */
  566. {
  567.    short collection;
  568.    short shape;
  569.    short flags;
  570. }
  571.  
  572. %collection:  Which collection the effect is from
  573. %animation: which animation it is
  574. %flags: unknown (???)
  575.  
  576.  
  577. ------------------------------------------------------------------------------
  578. 'proj' chunk:
  579. ------------------------------------------------------------------------------
  580.  
  581. Projectiles are the bullets that everyone fires.  No rocket science here.
  582.  
  583. enum /* projectile flags */
  584. {
  585.      _projectileGuided =       0x0001,
  586.      _projectileNoAnimation =  0x0002,
  587.      _projectilePersistent =   0x0004,
  588.      _projectileAlien =        0x0008,
  589.      _projectileGravity =      0x0010,
  590.      _projectileNoHErr =       0x0020,
  591.      _projectileNoVErr =       0x0040,
  592.      _projectileHitSwitch =    0x0080,
  593.      _projectilePositiveVErr = 0x0100,
  594.      _projectileMelee =        0x0200
  595. };
  596.  
  597. %_projectileGuided: tracks targets apparently - useless for user weapons at the moment
  598. %_projectileNoAnimation: projectile stops when animation loops - ex flamethrower
  599. %_projectilePersistent: ???
  600. %_projectileAlien: does less damage and moves slower on lower levels
  601. %_projectileGravity: projectile is affected by gravity
  602. %_projectileNoHErr: no horizontal error - spread is entirely vertical
  603. %_projectileNoVErr: no vertical error - spead is entirely horizontal
  604. %_projectileHitSwitch: projectile can toggle switches
  605. %_projectilePositiveVErr: positive vertical error - only shoots high? (??)
  606. %_projectileMelee: can use a monster's custom melee detonation (??)
  607.  
  608. struct projectile_entry  /* 36 bytes */
  609. {
  610.      short collection;
  611.      short shape_index;
  612.  
  613.      short detonation_effect;
  614.  
  615.      short contrail_effect;
  616.      short ticks_between_contrails;
  617.      short maximum_contrails;
  618.  
  619.      world_distance radius; 
  620.      world_distance area_of_effect; 
  621.  
  622.      short damage_type;
  623.      short damage_flags;
  624.      short damage_base, damage_random
  625.      fixed damage_scale;
  626.  
  627.      word flags;
  628.  
  629.      world_distance speed;
  630.      world_distance maximum_range;
  631.      
  632.      short flyby_sound;
  633. };
  634.  
  635. %collection: if -1 (NONE), then this is invisible
  636. %maximum_contrails: how many contrails will be left.  if -1 (NONE), then this is treated as infinite
  637. %radius: proximity radius - can be zero and will still hit
  638. %area_of_effect: detonation radius - one target if = 0
  639.  
  640. ------------------------------------------------------------------------------
  641. 'weap' chunk:
  642. ------------------------------------------------------------------------------
  643.  
  644. Lots of stuff to play with here.  Unfortunately, it seems like a fair amount of stuff
  645. is hardcoded, like where ammo is displayed, ammo shapes on the screen, weapon names, etc.  
  646.  
  647. struct weapon_entry /* 120 bytes */
  648. {
  649.    short type;
  650.    short class;
  651.    unsigned short flags;
  652.  
  653.    short ammunition_type;
  654.    short rounds_per_magazine;
  655.    short secondary_ammunition_type;
  656.    short secondary_rounds_per_magazine;
  657.  
  658.    fixed firing_light_intensity;
  659.    short firing_intensity_decay_ticks;
  660.  
  661.    fixed idle_height;
  662.    fixed bob_amplitude;
  663.    fixed kick_height;
  664.    fixed reload_height;
  665.    fixed idle_width;
  666.    fixed horizontal_amplitude;
  667.  
  668.    short collection;
  669.    short idle_shape;
  670.    short firing_shape;
  671.    short reloading_shape;
  672.    short shell_casing_shape;
  673.    short charging_shape;
  674.    short charged_shape;
  675.  
  676.    short primary_ticks_per_round;
  677.    short secondary_ticks_per_round;
  678.    short reload_ticks;
  679.    short ready_ticks;
  680.    short primary_recovery_ticks;
  681.    short secondary_recovery_ticks;
  682.    short primary_charging_ticks;
  683.    short secondary_charging_ticks;
  684.  
  685.    world_distance primary_recoil_magnitude;
  686.    world_distance secondary_recoil_magnitude;
  687.  
  688.    short primary_firing_sound;
  689.    short secondary_firing_sound;
  690.    short primary_click_sound;
  691.    short secondary_click_sound;
  692.    short reload_sound;
  693.    short charging_sound;
  694.    short primary_shell_casing_sound;
  695.    short secondary_shell_casing_sound;
  696.    short primary_sound_activation_range;
  697.    short secondary_sound_activation_range;
  698.  
  699.    short primary_round_projectile_type;
  700.    short secondary_round_projectile_type;
  701.  
  702.    short short primary_theta_error;
  703.    short secondary_theta_error;
  704.  
  705.    short primary_dx;
  706.    short primary_dz;
  707.    short secondary_dx;
  708.    short secondary_dz;
  709.  
  710.    short primary_burst_count;
  711.    short secondary_burst_count;
  712.  
  713.    short instant_reload_tick;
  714. };
  715. %type: unknown (???)
  716. %class: unknown (???)
  717. %ammunition_type: what type of ammo gets used up
  718. ∞rounds_per_magazine:  how many roungs you get to fire before reloading
  719. ∞secondary_ammunition_type: ammo for the secondary weapon (if any)
  720. %short secondary_rounds_per_magazine: rounds/clip for the secondary weapon (if any)
  721. %fixed firing_light_intensity: how much the room lights up when firing (?)
  722. %short firing_intensity_decay_ticks: how long the light lasts
  723. %fixed idle_height: how high the weapon appears when being held
  724. %fixed bob_amplitude: how much the weapon bounces when moving
  725. %fixed kick_height: recoil height
  726. %fixed reload_height: how far it goes up when reloading (?)
  727. %fixed idle_width: width of weapon when idle (???)
  728. %fixed horizontal_amplitude: side to side sway (???)
  729. %short collection: collection of shapes for the weapon
  730. %short idle_shape: shape when idle
  731. %short firing_shape: shape when firing
  732. %short reloading_shape: shape when reloading
  733. %short shell_casing_shape: the casing shape, if any.
  734. $short charging_shape: Shape when a weapon is being charged
  735. %short charged_shape: Shape when a weapon is charged
  736.  
  737. %short primary_ticks_per_round: How many ticks to fire a round (?)
  738. %short secondary_ticks_per_round: How many ticks to fire a round (?)
  739. %short reload_ticks: ticks to reload weapon
  740. %short ready_ticks: ticks to 'draw' weapon
  741. %short primary_recovery_ticks: time to recover from recoil for primary weapon
  742. %short secondary_recovery_ticks: time to recover from recoil for secondary weapon
  743. %short primary_charging_ticks: time to charge primary weapon
  744. %short secondary_charging_ticks: time to charge secondary weapon
  745. %world_distance primary_recoil_magnitude: how far the weapon recoils when firing primary
  746. %world_distance secondary_recoil_magnitude: how far the weapon recoils when firing secondary
  747. %short primary_firing_sound: sound when firing primary weapon
  748. %short secondary_firing_sound: sound when firing secondary weapon
  749. %short primary_click_sound: primary weapon is empty
  750. %short secondary_click_sound: secondary weapon is empty
  751. %short reload_sound: sound when reloading
  752. %short charging_sound: sound when charing
  753. %short primary_shell_casing_sound: sound of casing for primary hitting ground
  754. %short secondary_shell_casing_sound: sound of casing for secondary hitting ground
  755. %short primary_sound_activation_range: (???)
  756. %short secondary_sound_activation_range: (???)
  757. %short primary_round_projectile_type: type of projectile fired from primary
  758. %short secondary_round_projectile_type: type of projectile fire from secondary
  759. %short primary_theta_error: 'spread' of the weapon for firing primary
  760. %short secondary_theta_error: 'spread' of the weapon for firing secondary
  761. %short primary_dx: displacement for the primary weapon firing in the horizontal direction.
  762. %short primary_dz: displacement for the primary weapon firing in the vertical direction
  763. %short secondary_dx: displacement for the secondary weapon firing in the horizontal direction
  764. %short secondary_dz: displacement for the primary weapon firing in the vertical direction
  765. %short primary_burst_count: burst fire for primary weapon
  766. %short secondary_burst_count: burst fire for secondary weapon
  767. %short instant_reload_tick: no idea (?)
  768.  
  769. ------------------------------------------------------------------------------
  770. MAP INFORMATION
  771. ------------------------------------------------------------------------------
  772.  
  773.    The Map file is by far the most complex of all the Marathon files. It
  774. contains all information about the structure and layout of the levels. Most
  775. Marathon Map files contain multiple levels, which are stored as follows:
  776.  
  777. header (128 bytes)
  778. level 1
  779. level 2
  780. level 3...
  781. ....
  782. level n
  783. trailer (n * 8 bytes)
  784.  
  785.    Each level contains a number of chunks. Not all chunks must be present, and
  786. they may be in any order, but levels will not function properly without certain
  787. chunks.
  788.  
  789.    The exact format for the header is as follows:
  790.  
  791. struct map_header /* 128 bytes */
  792. {
  793.    short type;
  794.    unsigned short flags;
  795.    char name[64]; 
  796.    long unknown; 
  797.    long map_size; 
  798.    short level_count; 
  799.    short unused[25]; //not quite..
  800. };
  801.  
  802. %type: usually zero, as far as I can see.
  803. %flags: usually zero, as far as I can see.
  804. %name: ASCII string, zero terminated, up to 64 characters. Usually "Merged Map
  805. Files", but for saved games this is the name of the file.
  806. %map_size: total size of map file, excluding trailer but including header
  807. %level_count: number of levels
  808.  
  809.    The trailer contains one entry for each level:
  810.  
  811. struct map_trailer_entry /* 8 bytes */
  812. {
  813.    long offset; 
  814.    long size; 
  815. };
  816.  
  817. %offset: offset from start of file to this level
  818. %size: total size of all chunks in this level
  819.  
  820.    Each chunk starts with a header, followed by a number of entries (exact size
  821. and number of entries depends on the type of chunk). The format for the chunk
  822. header is as follows:
  823.  
  824. struct map_chunk_header /* 12 bytes */
  825. {
  826.    long chunk_type;
  827.    long offset;
  828.    long size;
  829.    //..rest of chunk data follows
  830. };
  831.  
  832. %chunk_type: 4 character ASCII string signifying chunk type
  833. %offset: offset from start of this level (not start of file) to next chunk
  834. %size: size of chunk
  835.  
  836. Chunk types:
  837.  
  838. 'iidx': exclusion zone chunk
  839. 'EPNT': vertex chunk (with extra info)
  840. 'PNTS': vertex chunk
  841. 'LINS': line chunk
  842. 'SIDS': side chunk
  843. 'POLY': polygon chunk
  844. 'NAME': name chunk (name of level)
  845. 'LITE': light source chunk
  846. 'NOTE': note chunk (text in automap)
  847. 'OBJS': object chunk
  848. 'p
  849. th': ???
  850. 'Minf': map-info chunk (?) (physics and environment info)
  851. 'plac': placement chunk
  852. 'door': ??? not used?
  853. 'plat': platform chunk (elevators, doors..)
  854. 'plyr': player chunk
  855. 'dwol': ???
  856. 'mobj': ???
  857. 'alin': ???
  858. 'apol': ???
  859. 'mOns': monster chunk??
  860. 'fx  ': effects chunk??
  861. 'bang': ???
  862. 'PLAT': ???
  863.  
  864. #define MAXIMUM_VERTICES    1024
  865. #define MAXIMUM_LINES       1024
  866. #define MAXIMUM_SIDES       1024
  867. #define MAXIMUM_POLYGONS     256
  868. #define MAXIMUM_LIGHTSOURCES  32
  869. #define MAXIMUM_OBJECTS      256
  870.  
  871. ------------------------------------------------------------------------------
  872. 'EPNT' / 'PNTS' chunk:
  873. ------------------------------------------------------------------------------
  874.  
  875. Each 'PNTS' entry is of type world_point2d.
  876. Each 'EPNT' entry has the following structure:
  877.  
  878. enum /* vertex flags */
  879. {
  880.    _vertexSolid =           0x0001,
  881.    _vertexMultipleHeights = 0x0002
  882. };
  883.  
  884. %_vertexSolid: ???
  885. %_vertexMultipleHeights: adjacent polygons have different heights
  886.  
  887. struct vertex_entry /* 16 bytes */
  888. {
  889.    unsigned short flags;
  890.  
  891.    world_distance highest_floor;
  892.    world_distance lowest_ceiling;
  893.  
  894.    world_point2d vertex;
  895.    world_point2d transformed;
  896.  
  897.    short polygon_index;
  898. };
  899.  
  900. %flags: see above
  901. %highest_adjacent_floor: highest adjacent floor height
  902. %lowest_adjacent_ceiling: lowest adjacent ceiling height
  903. %vertex: coordinates of vertex
  904. %transformed: ???
  905. %polygon_index: ???
  906.  
  907. ------------------------------------------------------------------------------
  908. 'LINS' chunk:
  909. ------------------------------------------------------------------------------
  910.  
  911. enum /* line flags */
  912. {
  913.    _lineSolid =             0x4000,
  914.    _lineTransparent =       0x2000,
  915.    _lineLandscaped =        0x1000,
  916.    _lineElevated =          0x0800,
  917.    _lineVariableElevation = 0x0400
  918. };
  919.  
  920. %_lineSolid: 
  921. %_lineTransparent: 
  922. %_lineLandscaped: 
  923. %_lineElevated: 
  924. %_lineVariableElevation: 
  925.  
  926. struct line_entry /* 32 bytes */
  927. {
  928.    short vertex_indexes[2];
  929.    unsigned short flags;
  930.  
  931.    world_distance length;
  932.    world_distance highest_floor;
  933.    world_distance lowest_ceiling;
  934.  
  935.    short left_side_index;
  936.    short right_side_index;
  937.  
  938.    short left_polygon_index;
  939.    short right_polygon_index;
  940.  
  941.    short unused[6];
  942. };
  943.  
  944. %vertex_indexes: endpoints of line
  945. %flags: see above
  946. %length: length of line
  947. %highest_floor: highest adjacent floor height
  948. %lowest_ceiling: lowest adjacent ceiling height
  949. %left_side_index: 
  950. %right_side_index:
  951. %left_polygon_index:
  952. %right_polygon_index:
  953.  
  954. ------------------------------------------------------------------------------
  955. 'SIDS' chunk:
  956. ------------------------------------------------------------------------------
  957.  
  958. enum /* side flags */
  959. {
  960.         _sideControlPanelStatus = 0x0001,
  961.         _sideControlPanel =       0x0002,
  962.         _sideRepairSwitch =       0x0004
  963. };
  964.  
  965. %_sideControlPanelStatus: 
  966. %_sideControlPanel:
  967. %_sideRepairSwitch: 
  968.  
  969. enum /* side types */
  970. {
  971.    _sideFull,
  972.    _sideHigh,
  973.    _sideLow,
  974.    _sideComposite,
  975.    _sideSplit
  976. };
  977.  
  978. %_sideFull: primary texture is mapped from ceiling down to floor
  979. %_sideHigh: primary texture is mapped from ceiling downwards
  980. %_sideLow: primary texture is mapped from floor upwards
  981. %_sideComposite: primary texture is mapped from ceiling down to floor, secondary
  982. texture is mapped ???
  983. %_sideSplit: primary texture is mapped from ceiling downards, and secondary
  984. texture is mapped from floor upwards
  985.  
  986. enum /* control panel side types */
  987. {
  988.    _panelOxygen,
  989.    _panelShield,
  990.    _panelDoubleShield,
  991.    _panelTripleShield,
  992.    _panelLightSwitch
  993.    _panelPlatformSwitch,
  994.    _panelPatternBuffer,
  995.    _panelUnused,
  996.    _panelCommTerminal
  997.    _panelSwitch,
  998.    _alienPanelDoubleShield
  999.    _alienPanelTripleShield,
  1000.    _alienPanelPlatformSwitch,
  1001.    _alienPanelPatternBuffer
  1002. };
  1003.  
  1004. enum /* transfer modes (for sides and polygons) */
  1005. {
  1006.    tNormal,
  1007.    tFadeToBlack,
  1008.    tInvisible,
  1009.    tSubInvisible,
  1010.    tPulsate, /* polygons only */
  1011.    tWobble, /* polygons only */
  1012.    tFastWobble, /* polygons only */
  1013.    tStatic,
  1014.    tSubStatic,
  1015.    tLandscape,
  1016.    tSmear, /* flat shading */
  1017.    tFadeOutStatic,
  1018.    tPulsateStatic,
  1019.    tFoldIn,
  1020.    tFoldOut,
  1021.    tHorizSlide,
  1022.    tFastHorizSlide,
  1023.    tVertSlide,
  1024.    tFastVertSlide,
  1025.    tWander,
  1026.    tFastWander
  1027. };
  1028.  
  1029. %tNormal: normal texture mapping
  1030. %tFadeToBlack: 
  1031. %tInvisible: 
  1032. %tSubInvisible: 
  1033. %tPulsate: 
  1034. %tWobble: 
  1035. %tFastWobble: 
  1036. %tStatic: 
  1037. %tSubStatic: 
  1038. %tLandscape: direct copy (no texture mapping). This is typically used to draw
  1039. the view outside of windows.
  1040. %tSmear: fill polygon with pixel (0,0)
  1041. %tFadeOutStatic: 
  1042. %tPulsateStatic: 
  1043. %tFoldIn: 
  1044. %tFoldOut: 
  1045. %tHorizSlide: 
  1046. %tFastHorizSlide: 
  1047. %tVertSlide: 
  1048. %tFastVertSlide: 
  1049. %tWander: 
  1050. %tFastWander: 
  1051.  
  1052. struct side_texture_struct /* 6 bytes */
  1053. {
  1054.    world_distance x0, y0;
  1055.    shape_descriptor texture;
  1056. };
  1057.  
  1058. %x0,y0: texture offsets
  1059. %texture: specifies texture set (first byte) and texture (second byte)
  1060.  
  1061. struct side_exclusion_zone /* 16 bytes */
  1062. {
  1063.    world_point2d e0, e1, e2, e3;
  1064. };
  1065.  
  1066. %e0,e1,e2,e3: 
  1067.  
  1068. struct side_entry /* 64 bytes */
  1069. {
  1070.    short type;
  1071.    unsigned short flags;
  1072.  
  1073.    struct side_texture_struct primary_texture;
  1074.    struct side_texture_struct secondary_texture;
  1075.    struct side_texture_struct transparent_texture;
  1076.  
  1077.    struct side_exclusion_zone exclusion_zone;
  1078.  
  1079.    short control_panel_type;
  1080.    short control_panel_permutation;
  1081.  
  1082.    short primary_transfer_mode;
  1083.    short secondary_transfer_mode;
  1084.    short transparent_transfer_mode;
  1085.  
  1086.    angle direction;
  1087.    short line_index;
  1088.  
  1089.    short unused[6];
  1090. };
  1091.  
  1092. ------------------------------------------------------------------------------
  1093. 'POLY' chunk:
  1094. ------------------------------------------------------------------------------
  1095.  
  1096. enum /* polygon flags */
  1097. {
  1098.    _polygonDetached =                  0x4000,
  1099.    _polygonPlatformInitiallyOff =      0x2000,
  1100.    _polygonPlatformInitiallyExtended = 0x1000
  1101. };
  1102.  
  1103. %_polygonDetached: ???
  1104. %_polygonPlatformInitiallyOff: platform is initially off
  1105. %_polygonPlatformInitiallyExtended: platform is initially extended
  1106.  
  1107. enum /* polygon types */
  1108. {
  1109.    _polygonNormal,
  1110.    _polygonItemImpassable,
  1111.    _polygonMonsterImpassable,
  1112.    _polygonMinorDamage,
  1113.    _polygonMajorDamage,
  1114.    _polygonPlatform,
  1115.    _polygonLightOnTrigger,
  1116.    _polygonPlatformOnTrigger,
  1117.    _polygonLightOffTrigger,
  1118.    _polygonPlatformOffTrigger,
  1119.    _polygonTeleporter,
  1120.    _polygonGlueTrigger,
  1121.    _polygonSuperglue,
  1122.    _polygonMustExplore,
  1123.    _polygonExit
  1124. };
  1125.  
  1126. struct polygon_entry /* 128 bytes */
  1127. {
  1128.    short type;
  1129.    unsigned short flags;
  1130.    short permutation;
  1131.  
  1132.    short vertex_count;
  1133.    short vertex_index[8]; 
  1134.    short line_index[8];
  1135.  
  1136.    shape_descriptor floor_texture;
  1137.    shape_descriptor ceiling_texture;
  1138.    world_distance floor_height;
  1139.    world_distance ceiling_height;
  1140.    short floor_lightsource_index;
  1141.    short ceiling_lightsource_index;
  1142.  
  1143.    long area;
  1144.  
  1145.    short first_object;
  1146.  
  1147.    short first_exclusion_zone_index;
  1148.    short line_exclusion_zone_count;
  1149.    short point_exclusion_zone_count;
  1150.  
  1151.    short floor_transfer_mode;
  1152.    short ceiling_transfer_mode;
  1153.  
  1154.    short adjacent_polygon_index[8];
  1155.  
  1156.    short first_neighbor_index;
  1157.    short neighbor_count;
  1158.  
  1159.    world_point2d center;
  1160.  
  1161.    short side_index[8];
  1162.  
  1163.    short unused[10];
  1164. };
  1165.  
  1166. ------------------------------------------------------------------------------
  1167. 'NAME' chunk:
  1168. ------------------------------------------------------------------------------
  1169.  
  1170. ------------------------------------------------------------------------------
  1171. 'LITE' chunk:
  1172. ------------------------------------------------------------------------------
  1173.  
  1174. enum /* light flags */
  1175. {
  1176.    _lightAutotriggered = 0x4000;
  1177. };
  1178.  
  1179. enum /* light types */
  1180. {
  1181.    _lightNormal,
  1182.    _lightRheostat,
  1183.    _lightFlourescent,
  1184.    _lightStrobe,
  1185.    _lightFlicker,
  1186.    _lightPulsate,
  1187.    _lightAnnoying,
  1188.    _lightEnergyEfficient
  1189. };
  1190.  
  1191. enum /* light modes */
  1192. {
  1193.    _lightTurningOn,
  1194.    _lightOn,
  1195.    _lightTurningOff,
  1196.    _lightOff,
  1197.    _lightToggle
  1198. };
  1199.  
  1200. struct lightsource_entry /* 32 bytes */
  1201. {
  1202.    unsigned short flags;
  1203.  
  1204.    short type;
  1205.    short mode;
  1206.    short phase;
  1207.  
  1208.    fixed minimum_intensity;
  1209.    fixed maximum_intensity;
  1210.    short period;
  1211.  
  1212.    fixed intensity;
  1213.  
  1214.    short unused[5];
  1215. };
  1216.  
  1217. ------------------------------------------------------------------------------
  1218. 'NOTE' chunk:
  1219. ------------------------------------------------------------------------------
  1220.  
  1221. ------------------------------------------------------------------------------
  1222. 'OBJS' chunk:
  1223. ------------------------------------------------------------------------------
  1224.  
  1225. enum /* map object types */
  1226. {
  1227.    _savedMonster,
  1228.    _savedObject,
  1229.    _savedItem,
  1230.    _savedPlayer,
  1231.    _savedGoal
  1232. };
  1233.  
  1234. struct map_object_entry /* 16 bytes */
  1235. {
  1236.    short type;
  1237.    short index;
  1238.    short facing;
  1239.    short polygon_index;
  1240.    world_point2d location;
  1241.    short unused[2];
  1242. };
  1243.  
  1244. ------------------------------------------------------------------------------
  1245. 'p
  1246. th' chunk:
  1247. ------------------------------------------------------------------------------
  1248.  
  1249. ------------------------------------------------------------------------------
  1250. 'Minf' chunk:
  1251. ------------------------------------------------------------------------------
  1252.  
  1253. enum /* mission flags */
  1254. {
  1255.    _missionNone =          0x0000,
  1256.    _missionExtermination = 0x0001,
  1257.    _missionExploration =   0x0002,
  1258.    _missionRetrieval =     0x0004,
  1259.    _missionRepair =        0x0008,
  1260.    _missionRescue =        0x0010
  1261. };
  1262.  
  1263. enum /* environment flags */
  1264. {
  1265.    _environmentNormal =     0x0000,
  1266.    _environmentVacuum =     0x0001,
  1267.    _environmentMagnetic =   0x0002,
  1268.    _environmentRebellion =  0x0004,
  1269.    _environmentLowGravity = 0x0008
  1270. };
  1271.  
  1272. struct static_entry /* 86 bytes */
  1273. {
  1274.    short environment_code;
  1275.  
  1276.    short physics_model;
  1277.  
  1278.    short song_index;
  1279.    unsigned short mission_flags;
  1280.    unsigned short environment_flags;
  1281.  
  1282.    short unused[4];
  1283.  
  1284.    char level_name[64];
  1285.    long entry_point_flags;
  1286. };
  1287.  
  1288. ------------------------------------------------------------------------------
  1289. 'plat' chunk:
  1290. ------------------------------------------------------------------------------
  1291.  
  1292. enum /* platform types */
  1293. {
  1294.    _platformInitiallyActive =                     0x00000001,
  1295.    _platformInitiallyExtended =                   0x00000002,
  1296.    _platformStopsAtEachLevel =                    0x00000004,
  1297.    _platformStopsAtInitialLevel =                 0x00000008,
  1298.    _platformActivatesAdjacentUponDeactivating =   0x00000010,
  1299.    _platformExtendsFloorToCeiling =               0x00000020,
  1300.    _platformExtendsFloor =                        0x00000040,
  1301.    _platformExtendsCeiling =                      0x00000080,
  1302.    _platformCausesDamage =                        0x00000100,
  1303.    _platformNoActivateParent =                    0x00000200,
  1304.    _platformOneShot =                             0x00000400,
  1305.    _platformActivatesLight =                      0x00000800,
  1306.    _platformDeactivatesLight =                    0x00001000,
  1307.    _platformPlayerControllable =                  0x00002000,
  1308.    _platformMonsterControllable =                 0x00004000,
  1309.    _platformSafety =                              0x00008000,
  1310.    _platformNoExternalActivate =                  0x00010000,
  1311.    _platformUsesNativeHeights =                   0x00020000,
  1312.    _platformDelaysBeforeActivate =                0x00040000,
  1313.    _platformActivatesAdjacentUponActivating =     0x00080000,
  1314.    _platformDeactivatesAdjacentUponActivating =   0x00100000,
  1315.    _platformDeactivatesAdjacentUponDeactivating = 0x00200000,
  1316.    _platformContractsSlow =                       0x00400000,
  1317.    _platformActivatesAdjacentOnEachLevel =        0x00800000,
  1318.    _platformFloods =                              0x01000000
  1319. };
  1320.  
  1321. struct platform_entry /* 16 bytes */
  1322. {
  1323.    short type;
  1324.  
  1325.    short speed;
  1326.    short delay;
  1327.  
  1328.    short maximum_height;
  1329.    short minimum_height;
  1330.  
  1331.    unsigned long flags;
  1332.  
  1333.    short owner_polygon_index;
  1334.  
  1335.    short unused[8];
  1336. };
  1337.  
  1338.  
  1339. -----------------------------------------------------------------------------
  1340. ------------------------------------------------------------------------------
  1341.  
  1342. enum /* game options */
  1343. {
  1344.    _gameMultiplayer = 0x0001,
  1345.    _gameReplenishAmmo = 0x0002,
  1346.    _gameReplenishWeapons = 0x0004,
  1347.    _gameReplenishSpecials = 0x0008,
  1348.    _gameReplenishMonsters = 0x0010,
  1349.    _gameNoMotionSensor = 0x0020,
  1350.    _gameOmniscientMap = 0x0040,
  1351.    _gameLoseItemsOnDeath = 0x0080,
  1352.    _gameDebugMap = 0x0100,
  1353.    _gameKillLimit = 0x0200,
  1354.    _gameNoTeams = 0x0400,
  1355.    _gamePenalizeDying = 0x0800,
  1356.    _gamePenalizeSuicide = 0x1000,
  1357.    _gameMapShowsItems = 0x2000,
  1358.    _gameMapShowsMonsters = 0x4000,
  1359.    _gameMapShowsProjectiles = 0x8000
  1360. };
  1361.  
  1362.